<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JSPGOU商品 - ${web.name}${web.additionalTitle!}</title>
<link href="${root}/u/css/main.css" type="text/css" rel="stylesheet" />
<link href="${root}/u/css/product.css" type="text/css" rel="stylesheet" />
<script src="${root}/u/js/jspgou/jquery1.42.min.js" type="text/javascript"></script>
<script src="${root}/u/js/jspgou/jquery.superslide.2.1.1.js" type="text/javascript"></script>
<script src="${root}/u/js/jspgou/leftlanmu.js" type="text/javascript"></script>
<script src="${root}/u/js/jspgou/1/lib.js" type="text/javascript"></script>
<script src="${root}/u/js/product.js" type="text/javascript"></script>
<script type="text/javascript">
function g(o){
	return document.getElementById(o);
}
function HoverLi(x,y,m,n,counter){
	for(var i=1;i<=counter;i++){
		g(x+m+i).className='normaltab';
		g(y+m+i).className='undis';
	}
	g(y+m+n).className='dis';
	g(x+m+n).className='curr';
}
//立即购买
/*function buyNow(productId) {
	var count = $('#product_amount').val()
	 location.href='${base}/buyNow.jspx?productId='+productId+'&count='+count;
}*/
//加入购物车js
[#if category.colorsize]
 function addToCart(productId,count,fashId) {
 	$.post('${base}/cart/add_orderItem.jspx', {
 		'productId' : productId,
 		'productAmount' : count,
 		'fashId': fashId
 	}, function(data) {
 		if(data.status==1) {
 			location.href='${base}/cart/shopping_cart.jspx?backUrl=${location}';
 		} else if(data.status==0) {
 			location.href='${loginUrl}';
 		} else if(data.status==4){
 			alert(data.error);
 			location.href='${product.url}';
 		}else {
 			$('#input1').css("display","block");
 			alert(data.error);
 		}
 		
 	},'json');
 }
function buyNow(productId,count,fashId){
	 $.post('${base}/cart/add_orderItem.jspx',{
		 'productId':productId,
		 'productAmount':count,
		 'fashId':fashId
	 },function(data) {
	 		if(data.status==1) {
	 			location.href='${base}/buyNow.jspx?productId='+productId+'&count='+count;
	 		} else if(data.status==0) {
	 			location.href='${loginUrl}';
	 		} else if(data.status==4){
	 			alert(data.error);
	 			location.href='${product.url}';
	 		}else {
	 			$('#input1').css("display","block");
	 			alert(data.error);
	 		}
	 		
	 	},'json');
 }
 [#else]
  function addToCart(productId,count) {
 	$.post('${base}/cart/add_orderItem.jspx', {
 		'productId' : productId,
 		'productAmount' : count
 	}, function(data) {
 		if(data.status==1) {
 			location.href='${base}/cart/shopping_cart.jspx?backUrl=${location}';
 		} else if(data.status==0) {
 			location.href='${loginUrl}';
 		}else if(data.status==4){	
 			alert(data.error);
 			location.herf='${product.url}'; 		
 		}else if(data.status==3){
 			alert(data.error);
 			location.href='${product.url}';
 		}else {
 			$('#input1').css("display","block");
 			alert(data.error);
 		}
 		
 	},'json');
 }
 function buyNow(productId,count) {
	 	$.post('${base}/cart/add_orderItem.jspx', {
	 		'productId' : productId,
	 		'productAmount' : count
	 	}, function(data) {
	 		if(data.status==1) {
	 			location.href='${base}/buyNow.jspx?productId='+productId+'&count='+count;
	 		} else if(data.status==0) {
	 			location.href='${loginUrl}';
	 		}else if(data.status==4){	
	 			alert(data.error);
	 			location.herf='${product.url}'; 		
	 		}else if(data.status==3){
	 			alert(data.error);
	 			location.href='${product.url}';
	 		}else {
	 			$('#input1').css("display","block");
	 			alert(data.error);
	 		}
	 		
	 	},'json');
	 }
[/#if]
//收藏功能js
function addToCollect(productId){
	$.post('${base}/collect/add_to_collect.jspx',{
		'productId':productId
		}, function(data){
            if(data.status == 1){
            	 alert('收藏成功!');
            }else if(data.status== 2){
                    alert('收藏过该商品');
            }else{
            	location.href='${base}/login.jspx';
            }
	   },'json');
}
</script>
<style>
#recentlyViewed .p-wrap {
    width:190px;
    margin:10px auto 15px auto;
}
#recentlyViewed li:last-child .p-wrap {
    border-bottom:1px dotted #dedede;
}
#recentlyViewed .p-img {
	margin:auto;width:184px;
}
#recentlyViewed .p-img img {
    width:184px;margin:auto;
}
#recentlyViewed .p-img img:hover {
    opacity: 0.5;
}
#recentlyViewed .p-info {
	line-height:18px;
	margin-top:5px;
}
#recentlyViewed .p-name {
}
#recentlyViewed .p-name a {
    color: #666;
    line-height: 18px;
    text-decoration: none;
}
#recentlyViewed .p-name a:hover {
    color: red;
    text-decoration: underline;
}
#recentlyViewed .p-price {
    color:#ff0000;
    font-family:Arial;
    height:30px;
	text-align:center;
    line-height:30px;
}
#recentlyViewed .p-price s {
    text-decoration: none;
}
</style>
</head>

<body style="background:url(${root}/u/img/jspgou/bg2.gif) repeat-x;">
<div class="w1187b">
	<div class="lm_w239">
        [#include "../include/全部商品分类.html"/]
    </div>
    <div class="lm_w948">
    	[#include "../include/页头顶栏.html"/]
    	[#include "../include/页头导航栏.html"/]
        <div class="w935b">
        	<!--页头搜索栏开始-->
            <form id="searchForm" action="${base}/search.jspx">
                <input name="q" id="q" value="${q!'请输入关键词'}" type="text" 
                       onfocus="if(this.value=='请输入关键词')this.value=''" 
                       onblur="if(this.value=='')this.value='请输入关键词'" class="key_search" />
                <input type="submit" value="" class="menu_search" />
            </form>
            <div class="hotwords">
                <span>热门：</span>
                [@keyword_list count= 6]
                [#if tag_list?size gt 0]
                [#list tag_list as kw]
                <a id="${kw.keyword}" onclick="parssKey(this);" style="cursor:pointer">${kw.keyword}</a> 
                [/#list]
                [#else]
                [/#if]
                [/@keyword_list]
            </div>
			<script type="text/javascript">
				function parssKey(o){
					var v=o.id;
					$("#q").val(v);
					document.getElementById("searchForm").submit();
				} 
			</script>
			<!--页头搜索栏结束-->	            
			<div class="clear10"></div>
    	</div>
        <img src="${root}/u/img/jspgou/line_r2.gif" width="10" height="" class="w10" />
    </div>
    <div class="clear10"></div>
    <div class="clear10"></div>
    <div class="clear10"></div>
</div>

<div class="w1161">     
	<div class="produce">	
		<div class="gallery " id="gallery_view">
			<div class="pic" id="mainPic">
				[#if product.pictures?? && product.pictures?size gt 0]
					[#list product.pictures as pic]
						[#if pic_index==0]
							<a id="productImgA" class="jqzoom" href="${root!}${pic.picturePath!}">
							<img id="productImg" src="${root!}${pic.picturePath!}" alt="${product.name!}" width="376" height="376"/>
							</a>
						[/#if]
					[/#list]
				[/#if]
			</div>
			<div class="clear"></div>
			<div class="pic_slide">
				<span class="prev" id="prevBtn"></span>
				<div class="pic_slide_box" id="sliderImgs">
					<ul id="detailPictureSlider">
					[#if product.pictures?? && product.pictures?size gt 0]
						[#list product.pictures as pic]
							[#if pic_index==0]
								<li><img  class="selected" src="${root!}${pic.picturePath!}" onmouseover="initCurrPicture(jQuery(this),'${root!}${pic.picturePath!}','${root!}${pic.picturePath!}')" width="58" height="58" /></li>
							[#else]
								<li><img src="${root!}${pic.picturePath!}" onmouseover="initCurrPicture(jQuery(this),'${root!}${pic.picturePath!}','${root!}${pic.picturePath!}')" width="58" height="58" /></li>
							[/#if]
						[/#list]
					[/#if]
					</ul>
				</div>
				<span class="next" id="nextBtn"></span>
			</div>
			<div class="clear10"></div>
			<div class="clear10"></div>
			<div class="fl">
				<span class="fl">分享到：</span>
					[#if category.colorsize]
						<a class="fl" style="margin-right:10px;" href="javascript:(function(){var rul=location.href;if(rul.indexOf('?')>0){rul = rul +'&'}else{rul = rul +'?'};rul = rul +'tarcker_u=9402576';window.open(' http://v.t.sina.com.cn/share/share.php?title=【${product.name!}】,JSPGOU价 ￥[#if product.productFashion??]${product.productFashion.salePrice!}[/#if]&url='+encodeURIComponent(rul),'_blank','width=615,height=505');})()"><img src="${root}/u/img/product/sina.gif" width="16" height="16" /></a>
						<a class="fl" href="javascript:void(0)" onclick="posttoWb('http://v.t.qq.com/share/share.php','${product.name!}￥[#if product.productFashion??]${product.productFashion.salePrice!}[/#if]','2fc26c2514bb48ec891170ce68db2683');" ><img src="${root}/u/img/product/tencent.gif" width="16" height="16" /></a>
					[#else]
						<a class="fl" style="margin-right:10px;" href="javascript:(function(){var rul=location.href;if(rul.indexOf('?')>0){rul = rul +'&'}else{rul = rul +'?'};rul = rul +'tarcker_u=9402576';window.open(' http://v.t.sina.com.cn/share/share.php?title=【${product.name!}】,JSPGOU价 ￥${product.salePrice!}&url='+encodeURIComponent(rul),'_blank','width=615,height=505');})()"><img src="${root}/u/img/product/sina.gif" width="16" height="16" /></a>
						<a class="fl" href="javascript:void(0)" onclick="posttoWb('http://v.t.qq.com/share/share.php','${product.name!}￥${product.salePrice!}','2fc26c2514bb48ec891170ce68db2683');" ><img src="${root}/u/img/product/tencent.gif" width="16" height="16" /></a>
					[/#if]
			</div>
			<div class="fr">
			  <a class="collection" href="javascript:void(0);" onclick="javascript:addToCollect(${product.id});">收藏商品</a>&nbsp;&nbsp;<span style="color:#5d5d5d;">人气：${product.viewCount!}</span>
			</div>
			
		</div>

		
		<div class="property property_box coat">
			<div class="p_title">${product.name!}</div>
			<div class="clear10"></div>
			<div class="specific_info1">
				[#if category.colorsize]
					<input type="hidden" id="current_merchantId" value="[#if product.productFashion??]${product.productFashion.id}[/#if]"/>	
					[#if product.productFashion??]
						<span class="p_price">¥<b class="sys_item_price">${product.productFashion.salePrice!}</b></span>
						<span class="p_marketPrice"><del>¥<b class="sys_item_mktprice">${product.productFashion.marketPrice!}</b></del></span>
						<div class="p_freight"><span style="color:#6f6f6f; margin-right:30px;">运费</span>南昌&nbsp;至&nbsp;上海市浦东新区<span style="margin-left:30px;">快递 ¥12.00</span>&nbsp;&nbsp;&nbsp;EMS ¥15.00&nbsp;&nbsp;&nbsp;平邮 ¥10.00</div>
						<div class="clear10"></div>
						<div class="p_statistics">
							<div class="fl" style="margin-left:20px;"><span>5.0分</span><p>评分</p></div>
							<div class="p_line"></div>
							<div class="fl">[@discuss_count productId=product.id]<span>${discusses?size}</span>[/@discuss_count]<p>累计评价</p></div>
							<div class="p_line"></div>
							<div class="fl">
								<span>
									[#if category.colorsize]
										[#if product.productFashion??]
											<b class="sys_item_saleCount">${product.productFashion.saleCount!0}</b>
										[/#if]
									[#else]
										${product.saleCount!0}
									[/#if]
								</span><p>销量</p>
							</div>
						</div>
					[/#if]
				[#else]
					<span class="p_price">¥${product.salePrice!}</span>
					<span class="p_marketPrice"><del>¥${product.marketPrice!}元</del></span>
					<div class="p_freight"><span style="color:#6f6f6f; margin-right:30px;">运费</span>南昌&nbsp;至&nbsp;上海市浦东新区<span style="margin-left:30px;">快递 ¥12.00</span>&nbsp;&nbsp;&nbsp;EMS ¥15.00&nbsp;&nbsp;&nbsp;平邮 ¥10.00</div>
				[/#if]
				[#if product.yushou??]
					[#if product.yushou??&&product.yushou==true&&product.yushoubegindate??&&product.yushoubegindate lte .now&&product.yushouenddate??&&product.yushouenddate gt .now]
						<dl class="clearfix">
						<dt>注&nbsp;&nbsp;&nbsp;意：</dt>
						<dd>此商品为预售商品[#if product.dingjin??],需支付定金${product.dingjin}元，[#if product.weikuan??]尾款为${product.weikuan}元,[/#if][#if product.yushoubegindate??]预售活动开始时间为${product.yushoubegindate},[/#if][#if product.yushouenddate??]截止时间为${product.yushouenddate}[/#if][/#if]</dd>
						</dl>
					[/#if]	
				[/#if]	
			</div>		
			<div class="clear"></div>
			<div class="specific_info2">
				[#if category.colorsize]
					<div class="sys_item_spec">
						[#list standardTypeList as standardType]
							[#if standardType.dataType]
								<dl class="sys_item_specpara clearfix" data-sid="${standardType_index+1}" [#if arr??]data-attrval="${arr[standardType_index]}"[/#if]>
									<dt>${standardType.name}</dt>
									<dd>
										<ul class="sys_spec_img">
											[#list psList as ps]
												[#if standardType.id=ps.type.id]
													<li data-aid="${ps.standard.id!}" [#if product.productFashion.standards?seq_contains(ps.standard)]class="selected"[#else]class=""[/#if]><a href="javascript:;" title="${ps.standard.name}"><img src="${root!}${ps.imgPath!}" alt="${ps.standard.name}" /></a><i></i></li>
												[/#if]
											[/#list]
										</ul>
									</dd>
								</dl>
							[#else]
								<dl class="sys_item_specpara clearfix" data-sid="${standardType_index+1}" [#if arr??]data-attrval="${arr[standardType_index]}"[/#if]>
									<dt>${standardType.name}</dt>
									<dd>
										<ul class="sys_spec_text">
											[#list psList as ps]
												[#if standardType.id=ps.type.id]
													<li data-aid="${ps.standard.id!}" [#if product.productFashion.standards?seq_contains(ps.standard)]class="selected"[#else]class=""[/#if]><a href="javascript:;" title="${ps.standard.name}">${ps.standard.name}</a><i></i></li>
												[/#if]
											[/#list]
										</ul>
									</dd>
								</dl>
							[/#if]
						[/#list]
					</div>
				[/#if]	
                <div class="clear10"></div>
				<dl id="goToBuyDistrict" class="clearfix">
					<dt>数量</dt>
					<dd>
						<div class="computing">
							<input type="button" class="reduce" onclick="decrementAll();"/>
							<input type="text" id="product_amount" name="productAmount" onchange ="buyButtonNumChange('product_amount')" class="num" onkeyup="inputOnlyNum(this, 1, 999);" value="1"/>
							<input type="button" class="add" onclick="incrementAll();"/>
						</div>
						<div style="line-height:28px; margin-left:5px; float:left; color:#3c3c3c;">
						件(库存
						[#if category.colorsize]
							[#if product.productFashion??]
								<b class="sys_item_stockCount">${product.productFashion.stockCount!}</b>
							[/#if]件)
						[#else]
							${product.stockCount!}件)
						[/#if]
						</div>
					</dd>
				</dl>
				<div class="clear10"></div>
				<div class="specific_info1">
					<dl class="clearfix">
						<dt style="color:#aeaeae;">商品编号：</dt>
						<dd id="productCode" style="font-family:Arial; color:#aeaeae;">${product.productExt.code!}</dd>
					</dl>		
				</div>									
				[#if category.colorsize]
					<div class="clear10"></div>           
					<table>
						<tr id="buyButtonsDistrict">
							<td width="40">&nbsp;</td>
							<td> 
								<form action="${base}/noctice/v_noctice.jspx" method="post" >
									[#if product.prohibit]
										[#if product.onSale]					
											[#if product.yushou??&&product.yushou==true&&product.yushoubegindate??&&product.yushoubegindate lte .now&&product.yushouenddate??&&product.yushouenddate gt .now]
												<input type="button" class="add_shopping_cart" value="付定金" onclick="javascript:addToYushou(${product.id},$('#product_amount').val());"/>
											[#else]
												<input type="hidden" value="${product.id}" name="productId"/>  
												<input type="submit" value="到货通知" style="color: red;display:none;" id="input1"   onclick="alert('你的通知已发送')">			
												<input type="button" class="add_shopping_cart_gm" value="立即购买" onclick="javascript:buyNow(${product.id},$('#product_amount').val(),$('#current_merchantId').val());" style="margin-right:10px;" />
												<input type="button" class="add_shopping_cart" value="加入购物车" onclick="javascript:addToCart(${product.id},$('#product_amount').val(),$('#current_merchantId').val());"/>
											[/#if]
										[#else] 
											<font  color="red">商品已下架</font>				
										[/#if]
									[#else] 
										<font color="red">商品已禁售</font>
									[/#if] 
								</form>
							</td>
							<td></td>
						</tr>
					</table>
				[#else]
					<table> 
						<tr id="buyButtonsDistrict">
							<td width="40">&nbsp;</td>
							<td> 						
								<form action="${base}/noctice/v_noctice.jspx" method="post" >
									[#if product.prohibit]
										[#if product.onSale]
											[#if product.yushou??&&product.yushou==true&&product.yushoubegindate??&&product.yushoubegindate lte .now&&product.yushouenddate??&&product.yushouenddate gt .now]
												<input type="button" class="add_shopping_cart" value="付定金" onclick="javascript:addToYushou(${product.id},$('#product_amount').val());"/>
											[#else]
												<input type="hidden" value="${product.id}" name="productId"/>  
												<input type="submit" value="到货通知" style="color: red;display:none;" id="input1"   onclick="alert('你的通知已发送')">
												<input type="button" class="add_shopping_cart_gm" value="立即购买" onclick="javascript:buyNow(${product.id},$('#product_amount').val());" style="margin-right:10px;" />
												<input type="button" class="add_shopping_cart" value="加入购物车" onclick="javascript:addToCart(${product.id},$('#product_amount').val());"/>							
											[/#if]
										[#else]
											<font  color="red">商品已下架</font>							
										[/#if]
									[#else] 
										<font  color="red">商品已禁售</font>
									[/#if] 
								</form>
							</td>
						</tr>
					</table>
				[/#if] 
			</div>      
		</div> 
	</div>   

	<div class="w200">
    	<div class="sellerName">
		[#if product.store??]
			${product.store.storeExt.shortName!}
		[#else]
			店中店自营
		[/#if]
		</div>
        <div class="shopScore"><div class="fl">店铺总评分</div><span>4.9</span><div class="fl">分</div></div>
        <div class="shopInformation">
            <p>信誉：</p>
            <p>掌柜：
			[#if product.store??]
			    [#if product.store.member??]
					${product.store.member.username!}
				[/#if]
			[#else]
				自营
			[/#if]
			</p>
            <p>联系：
			[#if product.store??]
				${product.store.member.tel!}
			[#else]
				自营
			[/#if]</p>
        </div>
        <div class="clear10"></div>
		${product.text1!}
        <!--<div class="genuineSafeguard">正品保障</div><div class="cashDelivery">货到付款</div>
        <div class="clear"></div>
        <div class="lightningDelivery">闪电发货</div>
        <div class="sevenDaysReturn">支持7天无理由退货</div>-->
        <div class="clear"></div>
        <div class="goShop">
		<!--进入店铺-->
			[#if product.store??]
				<a href="${product.store.storeExt.url!}"><input type="submit" name="button" id="button" value="" class="jindianpu" /></a>
				<input type="submit" name="button" id="button" value="" class="shouchang" />
			[#else]
			[/#if]
        </div>
    </div>
</div>
<div class="clear10"></div>
<div class="clear10"></div>
<div class="clear10"></div>
<div class="w1161">
	<div class="w210">
		<!--店内分类开始-->
		
		<!--店内分类结束-->
		<!--看了又看开始-->
        <div class="w210Box">
        <div id="recentlyViewed">
			<div class="w210BoxTitle">看了又看</div>
		    <div id="liulan"></div>
		</div>
        </div>
		<!--看了又看结束-->
    </div>
    <div class="w939">
        <div class="commodity">
        <ul>
        <li onmouseover="HoverLi('ts_','tsn_',1,1,4);" class="curr" id="ts_11">商品详情</li>
        <li onmouseover="HoverLi('ts_','tsn_',1,2,4);" class="normaltab" id="ts_12">商品参数</li>
        [@discuss_count productId=product.id]
        <li onmouseover="HoverLi('ts_','tsn_',1,3,4);" class="normaltab" id="ts_13">商品评价(${discusses?size})</li>
        [/@discuss_count]
        [@order_item_page productId=product.id count='20' status='19']
    	   [#if tag_list??]
              <li onmouseover="HoverLi('ts_','tsn_',1,4,4);" class="normaltab" id="ts_14">成交记录(${tag_list?size})</li>
           [/#if]
    	[/@order_item_page]
        </ul>
        </div>
        <div class="clear"></div>
        <div class="dis" id="tsn_11">
            <div style="margin:10px auto; width:98%; line-height:24px;">
                ${product.text!}
            </div>
        </div>
        <div class="undis" id="tsn_12">
            <div style="margin:10px auto; width:98%; line-height:24px;">
                
            </div>
        </div>
        <div class="undis" id="tsn_13">
            <div style="margin:auto; width:930px;">
                <iframe width="930" frameborder=0 scrolling=no src="${base}/searchDiscussPage.jspx?productId=${product.id!}" name="rightFrame" noresize="noresize" id="rightFrame"  height="800">
				</iframe>
            </div>
        </div>
        <div class="undis" id="tsn_14">
            <div style="margin:auto; width:930px;">
                 <iframe width="930" frameborder=0 scrolling=no src="${base}/bargain.jspx?productId=${product.id!}" name="rightFrame" noresize="noresize" id="rightFrame"  height="800">
				 </iframe>
            </div>
        </div>
    </div>
</div>

[#include "../include/页脚信息栏.html"/]
<script type="text/javascript">
		var p_id = "${product.id}";
		var p_title = "${product.name!}";
		var p_price = "${product.salePrice!}";
		var p_url = "${product.url!}";
		var p_pic = "";
		[#if product.pictures?? && product.pictures?size gt 0]
			[#list product.pictures as pic]
		 		[#if pic_index==0]
					p_pic ="${root!}${pic.picturePath!}";
		 		[/#if]
		  [/#list]
		[/#if]
		var id = "product";
		var price = "price";
		var title = "title";
		var pic = "pic";
		var url = "url";

		
		//*取出cookie并显示
		for(i = 0 ;i<5;i++){
			title = title+i;
			price = price+i;
			pic = pic+i;
			url = url+i;
			var arr0 = document.cookie.match(new RegExp("(^| )"+title+"=([^;]*)(;|$)"));
			var arr1 = document.cookie.match(new RegExp("(^| )"+price+"=([^;]*)(;|$)"));
			var arr2 = document.cookie.match(new RegExp("(^| )"+pic+"=([^;]*)(;|$)"));
			var arr3 = document.cookie.match(new RegExp("(^| )"+url+"=([^;]*)(;|$)"));
			if(arr0 != null ){
				var str = "<ul><li>"+
					"<div class='p-wrap'>"+
				"<div class='p-img'>"+
				"<a target='_blank' href="+unescape(arr3[2])+">"+
				"<img src='"+unescape(arr2[2])+"'>"+
				"</a>"+
				"</div>"+
				"<div class='p-info'>"+
				"<div class='p-name'>"+
				"<a target='_blank' title='"+unescape(arr0[2])+"' href='"+unescape(arr3[2])+"'>"+unescape(arr0[2])+"</a>"+
				"</div>"+
				"<div class='p-price'>"+
				"<s>￥</s>"+unescape(arr1[2])+
				"</div>"+
				"</div>"+
				"</div>"+
				"</li></ul>";
				$("#liulan").append(str);
			}
			price = "price";
			title = "title";
			pic = "pic";
			url = "url";
		}
		
		var number = 4;
		SetCookie();
		function SetCookie()//两个参数，一个是cookie的名子，一个是值
		{
			var Days = 30; //此 cookie 将被保存 30 天
		    var exp  = new Date();    //new Date("December 31, 9998");
		    exp.setTime(exp.getTime() + Days*24*60*60*1000);
			for(i = 0 ;i<5;i++){
				id = id+i;
				var arr = document.cookie.match(new RegExp("(^| )"+id+"=([^;]*)(;|$)"));
				if(arr != null && getCookie(id) == p_id){
					title = title+i;
					price = price+i;
					pic = pic+i;
					url = url+i;
					delCookie(id);
					delCookie(title);
					delCookie(price);
					delCookie(pic);
					delCookie(url);
					number = i;
				}
				id = "product";
				price = "price";
				title = "title";
				pic = "pic";
				url = "url";
			}
			for(var i = number ;i>0;i--){
				id0 = id+(i-1);
			    price0 = price+(i-1);
			    title0 = title+(i-1);
			    pic0 = pic+(i-1);
			    url0 = url+(i-1);
			    id = id +i;
			    price = price+i;
			    title = title+i;
			    pic = pic+i;
			    url = url + i;
			    if(getCookie(id0) != null){
			    	document.cookie = id + "="+ escape (getCookie(id0)) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
				    document.cookie = price + "="+ escape (getCookie(price0)) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
				    document.cookie = title + "="+ escape (getCookie(title0)) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
				    document.cookie = pic + "="+ escape (getCookie(pic0)) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
				    document.cookie = url + "="+ escape (getCookie(url0)) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
			    }
			    
			    id = "product";
			    price = "price";
				title = "title";
				pic = "pic";
				url = "url";
			}
			
		    
			//* 让当前商品相关cookie保存为第0个
		    id = id+"0";
		    price = price+"0";
		    title = title+"0";
		    pic = pic+"0";
		    url = url +"0";
		    document.cookie = id + "="+ escape (p_id) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
		    document.cookie = price + "="+ escape (p_price) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
		    document.cookie = title + "="+ escape (p_title) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
		    document.cookie = pic + "="+ escape (p_pic) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
		    document.cookie = url + "="+ escape (p_url) + ";expires=" + exp.toGMTString()+";path=/;domain=.jeecms.com";
		    id = "product";
		    price = "price";
			title = "title";
			pic = "pic";
			url = "url";
		}
		
		
		
		function getCookie(name){//取cookies函数 
				var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
				if(arr != null ){
					return unescape(arr[2]);
				}else if(i == 5){
					return null;
				}
		}
		function delCookie(name)//删除cookie
		{
		    var exp = new Date();
		    exp.setTime(exp.getTime() - 1);
		    var cval=getCookie(name);
		    if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
		}
		</script>
 
 
 
 [#if category.colorsize]
 <script language="JavaScript" type="text/JavaScript">
var sys_item={
		[#if product.productFashion??]
				"mktprice":"${product.productFashion.marketPrice!}",
				"price":"${product.productFashion.salePrice!}",
				"attitude":"${product.productFashion.attitude!}",
				"fashId":"${product.productFashion.id!}",
				"stockCount":"${product.productFashion.stockCount!}",
				"saleCount":"${product.productFashion.saleCount!}",
        [#else]
     	"mktprice":"",
		"price":"",
		"attitude":"",
		"attitude":"",
		"fashId":"",
		"stockCount":"",
		"saleCount":"",
		[/#if]
	
		"sys_attrprice":{
			[#list product.fashions as fash]
			 [#if fash_has_next]
			  "${fash.nature!}":{"price":"${fash.salePrice!}","mktprice":"${fash.marketPrice!}","attitude":"${fash.attitude!}","stockCount":"${fash.stockCount!}","saleCount":"${fash.saleCount!}","fashId":"${fash.id!}"},
             [#else]
              "${fash.nature!}":{"price":"${fash.salePrice!}","mktprice":"${fash.marketPrice!}","attitude":"${fash.attitude!}","stockCount":"${fash.stockCount!}","saleCount":"${fash.saleCount!}","fashId":"${fash.id!}"}
			 [/#if]
			[/#list]
		}
	};

//商品规格选择
$(function(){
	$(".sys_item_spec .sys_item_specpara").each(function(){
		var i=$(this);
		var p=i.find("ul>li");
		p.click(function(){
			if(!!$(this).hasClass("selected")){
				$(this).removeClass("selected");
				i.removeAttr("data-attrval");
			}else{
				$(this).addClass("selected").siblings("li").removeClass("selected");
				i.attr("data-attrval",$(this).attr("data-aid"))
			}
			getattrprice() //输出价格和库存
		})
	})
	//获取对应属性的价格/库存/销量
	function getattrprice(){
		var defaultstats=true;
		var _val='';
		var _resp={
			mktprice:".sys_item_mktprice",
			price:".sys_item_price",
			stockCount:".sys_item_stockCount",
			saleCount:".sys_item_saleCount",
			attitude:".sys_item_attitude"
		}  //输出对应的class
		$(".sys_item_spec .sys_item_specpara").each(function(){
			var i=$(this);
			var v=i.attr("data-attrval");
			if(!v){
				defaultstats=false;
			}else{
				_val+=_val!=""?"_":"";
				_val+=v;
			}
		})
		
		if(!!defaultstats){
			if((sys_item['sys_attrprice'][_val])!=undefined){
				_mktprice=sys_item['sys_attrprice'][_val]['mktprice'];
				_price=sys_item['sys_attrprice'][_val]['price'];
				_attitude=sys_item['sys_attrprice'][_val]['attitude'];
				_stockCount=sys_item['sys_attrprice'][_val]['stockCount'];
				_saleCount=sys_item['sys_attrprice'][_val]['saleCount'];
				_fashId=sys_item['sys_attrprice'][_val]['fashId'];
			}else{
				alert("您选择的商品已无库存！");
				_mktprice=sys_item['mktprice'];
				_price=sys_item['price'];
				_attitude=sys_item['attitude'];
				_stockCount=sys_item['stockCount'];
				_saleCount=sys_item['saleCount'];
				_fashId=sys_item['fashId'];
			}
			
		}else{
			_mktprice=sys_item['mktprice'];
			_price=sys_item['price'];
			_stockCount=sys_item['stockCount'];
			_saleCount=sys_item['saleCount'];
			_attitude=sys_item['attitude'];
			_fashId=sys_item['fashId'];
		}
		//输出价格
		$(_resp.mktprice).text(_mktprice);  ///其中的math.round为截取小数点位数
		$(_resp.price).text(_price);
		$(_resp.stockCount).text(_stockCount);
		$(_resp.saleCount).text(_saleCount);
		$(_resp.attitude).text(_attitude);
		$("#current_merchantId").val(_fashId);
	}
})

</script>
[/#if]
</body>
</html>